package com.xiongmm.stream.domain;

import java.io.Serializable;
import java.util.Map;

/**
 * @author: XiongMM
 * @date: 2019/5/24 09:01
 * @description: 用于封装相关info all里面的相关指标
 */
public class InstanceInfoAllVo implements Serializable {

    private static final long serialVersionUID = -857267391818284196L;

    /**
     * 主键
     */
    private Long id;

    /**
     * 集群ID
     */
    private Long appId;

    /**
     * 实例ID
     */
    private Long instanceId;

    /**
     * 机器ID
     */
    private Long hostId;

    /**
     * ip
     */
    private String ip;

    /**
     * 端口
     */
    private Integer port;

    /**
     * 内存使用率 (计算得到)
     */
    private String memUsePercent="0";

    /**
     * 最大内存 单位byte（config get maxmemory）
     */
    private Long maxMem;
    /**
     * 单位byte (info memory --> used_memory)
     */
    private Long usedMem;

    /**
     *  (info memory -->mem_fragmentation_ratio)
     */
    private String memFragmentationRatio;

    /**
     * 键的个数（info keyspace -> keys）
     */
    private Long keyCount=0L;

    /**
     * 设置了过期时间的key (info keyspace -> expires)
     */
    private Long hasExpireKeyCount=0L;

    /**
     * 已过期key的历史数量(info stats --> expired_keys)
     */
    private Long expiredKeyCount=0L;

    /**
     * 逐出key的历史数量（info stats --> evicted_keys）
     */
    private Long evictedKeyCount=0L;

    /**
     * 距离上次统计已过期的差值（ expired_keys 一分钟的差值）
     */
    private Long expiredKeysDiff=0L;

    /**
     * 距离上次统计已逐出的差值（ evicted_keys --> 一分钟的差值）
     */
    private Long evictedKeysDiff=0L;

    /**
     * qps（info stats --> instantaneous_ops_per_sec）
     */
    private Integer qps=0;

    /**
     * 未命中数 （info stats --> keyspace_misses）
     */
    private Long misses=0L;

    /**
     * 命中数 （info stats --> keyspace_hits）
     */
    private Long hits=0L;

    /**
     * 未命中数的差值（keyspace_misses 一分钟内存差值）
     */
    private Long missesDiff=0L;

    /**
     * 命中数的差值（keyspace_hits 一份钟内的差值）
     */
    private Long hitsDiff=0L;

    /**
     * 命中率 需要计算 --> hitsDiff / (hitsDiff + missesDiff)
     */
    private String hitPercent="0";

    /**
     * 当前连接数 （info clients --> connected_clients）
     */
    private Integer currConnections=0;

    /**
     * 角色 （info Replication --> role ） 枚举 master - 1 slave -2
     */
    private Integer role;

    /**
     * fork耗时 单位 微妙 （info stats --> latest_fork_usec）
     */
    private Integer latestForkUsec;

    /**
     * 是否进行aof重写 （info persistence --> aof_rewrite_in_progress） 枚举 是-1 否-0
     */
    private Integer aofRewriteInProgress;

    /**
     * 最近一次创建AOF文件耗费的时长， 单位：秒 （info persistence --> aof_last_rewrite_time_sec）
     * 注意：这里-1的时候，要存0，数据库未unsigend
     */
    private Integer aofLastRewriteTimeSec=0;

    /**
     * 当前aof文件大小 单位bytes (info persistence --> aof_current_size)
     */
    private Long aofCurrentSize=0L;

    /**
     * 最近一次执行aof文件的大小 单位bytes (info persistece --> aof_base_size)
     */
    private Long aofBaseSize=0L;

    /**
     * bgsave的状态：（info persistence --> rdb_last_bgsave_status ）枚举 成功-ok-1，失败-err-2
     */
    private Integer rdbLastBgsaveStatus;

    /**
     * 上次生成rdb的时间 单位：秒（info persistence --> rdb_last_bgsave_time_sec）
     */
    private Integer rdbLastSaveTime=0;

    /**
     * 阻塞连接到个数 （info clients --> blocked_clients）
     */
    private Integer blockedClients=0;

    /**
     * 客户端输入缓存区 （info clients ---> client_biggest_input_buf）
     */
    private Integer clientInputBuf=0;

    /**
     * 客户端最大输出列表 （info clients --> client_longest_output_list）
     */
    private Integer clientOutputList=0;

    /**
     * redis处理命令数 （info stats --> total_commands_processed）
     */
    private Long totalCommandsProcessed=0L;

    /**
     * redis处理命令的差值 （total_commands_processed 一分钟的差值 ）
     */
    private Integer totalCommandsProcessedDiff=0;

    /**
     * 主从连接状态 (info replication --> master-link-status --> salve才有) 枚举 up-1 down-2
     * 没有就不填 默认为null
     */
    private Integer masterLinkStatus;

    /**
     * 主从连接断开时间 单位秒（info Replication --> master_link_down_since_seconds --> salve才有且master_link_down才有）
     * 没有就不填，默认为null
     */
    private Integer masterLinkDownSinceSeconds;

    /**
     * 主库多少秒未发送数据到从库 单位 秒 （info replication --> master_last_io_seconds_ago --> slave才有）
     * 没有就不填，默认为null
     */
    private Integer masterLastIoSecondsAgo;

    /**
     * 从实例到个数 （info replication --> connected_slaves --- master才有）
     */
    private Integer connectedSalves;

    /**
     * 只取slave0 , (info replication --> slave0 ---> master有从实例时才有) 0或者1
     * 给个默认值，默认为null
     */
    private Integer slaveLag;

    /**
     * Redis服务器耗费的系统CPU (info cpu ---> used_cpu_sys)
     */
    private String redisUsedCpuSys;

    /**
     * Redis服务器耗费的用户CPU (info cpu ---> used_cpu_user)
     */
    private String redisUsedCpuUser;

    /**
     * Redis后台进程耗费的系统CPU (info cpu ---> used_cpu_sys_child)
     */
    private String redisUsedCpuSysChild;

    /**
     * Redis后台进程耗费的用户CPU (info cpu ---> used_cpu_user_child)
     */
    private String redisUsedCpuUserChild;

    /**
     * info commandstats
     */
    private Map<String, Object> cmdInfos;

    /**
     * 收集到时间戳
     */
    private Long collectTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getAppId() {
        return appId;
    }

    public void setAppId(Long appId) {
        this.appId = appId;
    }

    public Long getInstanceId() {
        return instanceId;
    }

    public void setInstanceId(Long instanceId) {
        this.instanceId = instanceId;
    }

    public Long getHostId() {
        return hostId;
    }

    public void setHostId(Long hostId) {
        this.hostId = hostId;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getMemUsePercent() {
        return memUsePercent;
    }

    public void setMemUsePercent(String memUsePercent) {
        this.memUsePercent = memUsePercent;
    }

    public Long getMaxMem() {
        return maxMem;
    }

    public void setMaxMem(Long maxMem) {
        this.maxMem = maxMem;
    }

    public Long getUsedMem() {
        return usedMem;
    }

    public void setUsedMem(Long usedMem) {
        this.usedMem = usedMem;
    }

    public String getMemFragmentationRatio() {
        return memFragmentationRatio;
    }

    public void setMemFragmentationRatio(String memFragmentationRatio) {
        this.memFragmentationRatio = memFragmentationRatio;
    }

    public Long getKeyCount() {
        return keyCount;
    }

    public void setKeyCount(Long keyCount) {
        this.keyCount = keyCount;
    }

    public Long getHasExpireKeyCount() {
        return hasExpireKeyCount;
    }

    public void setHasExpireKeyCount(Long hasExpireKeyCount) {
        this.hasExpireKeyCount = hasExpireKeyCount;
    }

    public Long getExpiredKeyCount() {
        return expiredKeyCount;
    }

    public void setExpiredKeyCount(Long expiredKeyCount) {
        this.expiredKeyCount = expiredKeyCount;
    }

    public Long getEvictedKeyCount() {
        return evictedKeyCount;
    }

    public void setEvictedKeyCount(Long evictedKeyCount) {
        this.evictedKeyCount = evictedKeyCount;
    }

    public Long getExpiredKeysDiff() {
        return expiredKeysDiff;
    }

    public void setExpiredKeysDiff(Long expiredKeysDiff) {
        this.expiredKeysDiff = expiredKeysDiff;
    }

    public Long getEvictedKeysDiff() {
        return evictedKeysDiff;
    }

    public void setEvictedKeysDiff(Long evictedKeysDiff) {
        this.evictedKeysDiff = evictedKeysDiff;
    }

    public Integer getQps() {
        return qps;
    }

    public void setQps(Integer qps) {
        this.qps = qps;
    }

    public Long getMisses() {
        return misses;
    }

    public void setMisses(Long misses) {
        this.misses = misses;
    }

    public Long getHits() {
        return hits;
    }

    public void setHits(Long hits) {
        this.hits = hits;
    }

    public Long getMissesDiff() {
        return missesDiff;
    }

    public void setMissesDiff(Long missesDiff) {
        this.missesDiff = missesDiff;
    }

    public Long getHitsDiff() {
        return hitsDiff;
    }

    public void setHitsDiff(Long hitsDiff) {
        this.hitsDiff = hitsDiff;
    }

    public String getHitPercent() {
        return hitPercent;
    }

    public void setHitPercent(String hitPercent) {
        this.hitPercent = hitPercent;
    }

    public Integer getCurrConnections() {
        return currConnections;
    }

    public void setCurrConnections(Integer currConnections) {
        this.currConnections = currConnections;
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    public Integer getLatestForkUsec() {
        return latestForkUsec;
    }

    public void setLatestForkUsec(Integer latestForkUsec) {
        this.latestForkUsec = latestForkUsec;
    }

    public Integer getAofRewriteInProgress() {
        return aofRewriteInProgress;
    }

    public void setAofRewriteInProgress(Integer aofRewriteInProgress) {
        this.aofRewriteInProgress = aofRewriteInProgress;
    }

    public Integer getAofLastRewriteTimeSec() {
        return aofLastRewriteTimeSec;
    }

    public void setAofLastRewriteTimeSec(Integer aofLastRewriteTimeSec) {
        this.aofLastRewriteTimeSec = aofLastRewriteTimeSec;
    }

    public Long getAofCurrentSize() {
        return aofCurrentSize;
    }

    public void setAofCurrentSize(Long aofCurrentSize) {
        this.aofCurrentSize = aofCurrentSize;
    }

    public Long getAofBaseSize() {
        return aofBaseSize;
    }

    public void setAofBaseSize(Long aofBaseSize) {
        this.aofBaseSize = aofBaseSize;
    }

    public Integer getRdbLastBgsaveStatus() {
        return rdbLastBgsaveStatus;
    }

    public void setRdbLastBgsaveStatus(Integer rdbLastBgsaveStatus) {
        this.rdbLastBgsaveStatus = rdbLastBgsaveStatus;
    }

    public Integer getRdbLastSaveTime() {
        return rdbLastSaveTime;
    }

    public void setRdbLastSaveTime(Integer rdbLastSaveTime) {
        this.rdbLastSaveTime = rdbLastSaveTime;
    }

    public Integer getBlockedClients() {
        return blockedClients;
    }

    public void setBlockedClients(Integer blockedClients) {
        this.blockedClients = blockedClients;
    }

    public Integer getClientInputBuf() {
        return clientInputBuf;
    }

    public void setClientInputBuf(Integer clientInputBuf) {
        this.clientInputBuf = clientInputBuf;
    }

    public Integer getClientOutputList() {
        return clientOutputList;
    }

    public void setClientOutputList(Integer clientOutputList) {
        this.clientOutputList = clientOutputList;
    }

    public Long getTotalCommandsProcessed() {
        return totalCommandsProcessed;
    }

    public void setTotalCommandsProcessed(Long totalCommandsProcessed) {
        this.totalCommandsProcessed = totalCommandsProcessed;
    }

    public Integer getTotalCommandsProcessedDiff() {
        return totalCommandsProcessedDiff;
    }

    public void setTotalCommandsProcessedDiff(Integer totalCommandsProcessedDiff) {
        this.totalCommandsProcessedDiff = totalCommandsProcessedDiff;
    }

    public Integer getMasterLinkStatus() {
        return masterLinkStatus;
    }

    public void setMasterLinkStatus(Integer masterLinkStatus) {
        this.masterLinkStatus = masterLinkStatus;
    }

    public Integer getMasterLinkDownSinceSeconds() {
        return masterLinkDownSinceSeconds;
    }

    public void setMasterLinkDownSinceSeconds(Integer masterLinkDownSinceSeconds) {
        this.masterLinkDownSinceSeconds = masterLinkDownSinceSeconds;
    }

    public Integer getMasterLastIoSecondsAgo() {
        return masterLastIoSecondsAgo;
    }

    public void setMasterLastIoSecondsAgo(Integer masterLastIoSecondsAgo) {
        this.masterLastIoSecondsAgo = masterLastIoSecondsAgo;
    }

    public Integer getConnectedSalves() {
        return connectedSalves;
    }

    public void setConnectedSalves(Integer connectedSalves) {
        this.connectedSalves = connectedSalves;
    }

    public Integer getSlaveLag() {
        return slaveLag;
    }

    public void setSlaveLag(Integer slaveLag) {
        this.slaveLag = slaveLag;
    }

    public String getRedisUsedCpuSys() {
        return redisUsedCpuSys;
    }

    public void setRedisUsedCpuSys(String redisUsedCpuSys) {
        this.redisUsedCpuSys = redisUsedCpuSys;
    }

    public String getRedisUsedCpuUser() {
        return redisUsedCpuUser;
    }

    public void setRedisUsedCpuUser(String redisUsedCpuUser) {
        this.redisUsedCpuUser = redisUsedCpuUser;
    }

    public String getRedisUsedCpuSysChild() {
        return redisUsedCpuSysChild;
    }

    public void setRedisUsedCpuSysChild(String redisUsedCpuSysChild) {
        this.redisUsedCpuSysChild = redisUsedCpuSysChild;
    }

    public String getRedisUsedCpuUserChild() {
        return redisUsedCpuUserChild;
    }

    public void setRedisUsedCpuUserChild(String redisUsedCpuUserChild) {
        this.redisUsedCpuUserChild = redisUsedCpuUserChild;
    }

    public Map<String, Object> getCmdInfos() {
        return cmdInfos;
    }

    public void setCmdInfos(Map<String, Object> cmdInfos) {
        this.cmdInfos = cmdInfos;
    }

    public Long getCollectTime() {
        return collectTime;
    }

    public void setCollectTime(Long collectTime) {
        this.collectTime = collectTime;
    }
}

